package es.juanc.load.recursos;

import java.io.InputStream;
import java.net.URL;

public class TestCargaRecursos {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		System.out.println( "getName: " + TestCargaRecursos.class.getName() );
		System.out.println( "getSimpleName: " + TestCargaRecursos.class.getSimpleName() );
		System.out.println( "getCanonicalName: " + TestCargaRecursos.class.getCanonicalName() );
		
		System.out.println();
		
		TestCargaRecursos t = new TestCargaRecursos();
		System.out.println( "get: " + t.get() );
		
		System.out.println();
		
		System.out.println( TestCargaRecursos.class.getResource( "/es/juanc/recursos/" + TestCargaRecursos.class.getSimpleName() + ".class" ) );
	}
	
	public String get() {
		
		//URL url = this.getClass().getResource( "config/props.txt" ); -> MALLLLLL
		URL url = this.getClass().getResource( "/config/props.txt" );
		System.out.println( "url: " + url );
		String p = url.getPath();
		System.out.println( "getPath: " + p );
		String h = url.getHost();
		System.out.println( "getHost: " + h );
		String f = url.getFile();
		System.out.println( "getFile: " + f );
		
		//InputStream is = this.getClass().getResourceAsStream( "props.txt" ); -> MALLLLLL
		InputStream is = this.getClass().getResourceAsStream( "/props.txt" );
		System.out.println( "is: " + is );
		//String rs = is.getRealPath();
		
		return "FIN";
	}
}
